import express from 'express'
import { EventEmitter } from 'events'
/* /event */

const router = express.Router() //路由模块

const event = new EventEmitter()
//监听test
event.on('test', data => {
  console.log('test', data)
})

router.get('/', (req, res) => {
  event.emit('test', 'xmxmxmxmx') //派发事件

  res.send({
    mgs:"event",
  })
})

export default router
